home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / an210x / bindery.frm < prev    next >
Text File  |  1995-05-08  |  13KB  |  377 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Bindery Object Lister"
  5.    ClientHeight    =   4725
  6.    ClientLeft      =   135
  7.    ClientTop       =   600
  8.    ClientWidth     =   9510
  9.    Height          =   5130
  10.    Icon            =   BINDERY.FRX:0000
  11.    Left            =   75
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   4725
  15.    ScaleWidth      =   9510
  16.    Top             =   255
  17.    Width           =   9630
  18.    Begin CommandButton CloseButton 
  19.       Caption         =   "Close"
  20.       Height          =   375
  21.       Left            =   7800
  22.       TabIndex        =   0
  23.       Top             =   4200
  24.       Width           =   1335
  25.    End
  26.    Begin CommandButton AboutButton 
  27.       Caption         =   "About ..."
  28.       Height          =   375
  29.       Left            =   6000
  30.       TabIndex        =   2
  31.       Top             =   3960
  32.       Width           =   1335
  33.    End
  34.    Begin CommandButton RescanButton 
  35.       Caption         =   "Rescan"
  36.       Height          =   375
  37.       Left            =   7800
  38.       TabIndex        =   16
  39.       Top             =   3720
  40.       Width           =   1335
  41.    End
  42.    Begin ListBox ServerNameBox 
  43.       Height          =   810
  44.       Left            =   1440
  45.       TabIndex        =   15
  46.       Top             =   3720
  47.       Width           =   3855
  48.    End
  49.    Begin ListBox BinderyObjList 
  50.       FontBold        =   -1  'True
  51.       FontItalic      =   0   'False
  52.       FontName        =   "Courier"
  53.       FontSize        =   9.75
  54.       FontStrikethru  =   0   'False
  55.       FontUnderline   =   0   'False
  56.       Height          =   2565
  57.       Left            =   45
  58.       Sorted          =   -1  'True
  59.       TabIndex        =   1
  60.       Top             =   945
  61.       Width           =   9420
  62.    End
  63.    Begin Label Label10 
  64.       Caption         =   "File Server:"
  65.       Height          =   255
  66.       Left            =   360
  67.       TabIndex        =   11
  68.       Top             =   3720
  69.       Width           =   1095
  70.    End
  71.    Begin Label Label1 
  72.       Caption         =   "Add Props"
  73.       Height          =   255
  74.       Left            =   8400
  75.       TabIndex        =   9
  76.       Top             =   600
  77.       Width           =   975
  78.    End
  79.    Begin Label Label7 
  80.       Caption         =   "Scan"
  81.       Height          =   255
  82.       Left            =   7800
  83.       TabIndex        =   8
  84.       Top             =   600
  85.       Width           =   495
  86.    End
  87.    Begin Label Label14 
  88.       BorderStyle     =   1  'Fixed Single
  89.       Caption         =   "Label14"
  90.       Height          =   15
  91.       Left            =   7800
  92.       TabIndex        =   12
  93.       Top             =   480
  94.       Width           =   1455
  95.    End
  96.    Begin Label Label4 
  97.       Caption         =   "Object ID"
  98.       Height          =   255
  99.       Left            =   5280
  100.       TabIndex        =   5
  101.       Top             =   480
  102.       Width           =   855
  103.    End
  104.    Begin Label Label3 
  105.       Caption         =   "Object Type"
  106.       Height          =   255
  107.       Left            =   3120
  108.       TabIndex        =   4
  109.       Top             =   480
  110.       Width           =   1095
  111.    End
  112.    Begin Label Label2 
  113.       Caption         =   "Object Name"
  114.       Height          =   255
  115.       Left            =   120
  116.       TabIndex        =   3
  117.       Top             =   480
  118.       Width           =   1215
  119.    End
  120.    Begin Label Label6 
  121.       Alignment       =   2  'Center
  122.       Caption         =   "Dyn/ Stat"
  123.       Height          =   375
  124.       Left            =   7035
  125.       TabIndex        =   7
  126.       Top             =   360
  127.       Width           =   615
  128.    End
  129.    Begin Label Label5 
  130.       Alignment       =   2  'Center
  131.       Caption         =   "Has Props"
  132.       Height          =   375
  133.       Left            =   6360
  134.       TabIndex        =   6
  135.       Top             =   360
  136.       Width           =   615
  137.    End
  138.    Begin Label Label8 
  139.       Caption         =   "Access Control"
  140.       Height          =   255
  141.       Left            =   7875
  142.       TabIndex        =   10
  143.       Top             =   225
  144.       Width           =   1335
  145.    End
  146.    Begin Label Label9 
  147.       BorderStyle     =   1  'Fixed Single
  148.       Caption         =   "Label9"
  149.       Height          =   855
  150.       Left            =   9450
  151.       TabIndex        =   13
  152.       Top             =   90
  153.       Width           =   15
  154.    End
  155.    Begin Label Label15 
  156.       BorderStyle     =   1  'Fixed Single
  157.       Caption         =   "Label15"
  158.       Height          =   15
  159.       Left            =   45
  160.       TabIndex        =   14
  161.       Top             =   90
  162.       Width           =   9420
  163.    End
  164.    Begin Label Label11 
  165.       BorderStyle     =   1  'Fixed Single
  166.       Height          =   915
  167.       Left            =   45
  168.       TabIndex        =   17
  169.       Top             =   90
  170.       Width           =   15
  171.    End
  172. End
  173.  
  174. Sub AboutButton_Click ()
  175.     Form2.Show 1
  176. End Sub
  177.  
  178. Function CheckDLLVersions (DLLName$, expMajVer%, expMinVer%, expRev%, expBeta%) As Integer
  179.  
  180.     CrLf$ = Chr$(13) + Chr$(10)
  181.  
  182.     ccode% = GetDLLVersion(DLLName$, majorVer%, minorVer%, revLevel%, betaLevel%)
  183.     If ((majorVer% < expMajVer%) Or ((majorVer% = expMajVer%) And (minorVer% < expMinVer%)) Or ((majorVer% = expMajVer%) And (minorVer% = expMinVer%) And (revLevel% < expRev%))) Then
  184.         'ignore beta level
  185.         Msg$ = "Incorrect version of " + DLLName$ + CrLf$
  186.         Msg$ = Msg$ + "Your version is: " + Str$(majorVer%) + "." + Format$(minorVer%, "#")
  187.         Msg$ = Msg$ + Format$(revLevel%, "#") + Format$(betaLevel%, "#") + CrLf$
  188.         Msg$ = Msg$ + "This program requires " + Str$(expMajVer%) + "." + Format$(expMinVer%, "#") + Format$(expRev%, "#") + " or above"
  189.         MsgBox Msg$, 16, "Critical Error"
  190.         CheckDLLVersions = False
  191.     Else
  192.         CheckDLLVersions = True
  193.     End If
  194. End Function
  195.  
  196. Sub CloseButton_Click ()
  197.     End
  198. End Sub
  199.  
  200. Sub Form_Load ()
  201.     Screen.MousePointer = 11        'change mouse cursor to hourglass
  202.  
  203.     'make sure we're using right versions of NetWare DLLs
  204.     If (Not CheckDLLVersions("NWCore.DLL", 1, 2, 2, 0)) Then
  205.         End
  206.     End If
  207.  
  208.     If (Not CheckDLLVersions("NWWrkstn.DLL", 1, 2, 2, 0)) Then
  209.         End
  210.     End If
  211.  
  212.     If (Not CheckDLLVersions("NWServer.DLL", 1, 2, 2, 0)) Then
  213.         End
  214.     End If
  215.  
  216.     If (Not CheckDLLVersions("NWBind.DLL", 1, 2, 2, 0)) Then
  217.         End
  218.     End If
  219.  
  220.     For connID& = 1 To 8
  221.         'for each connection in workstation's file server name table
  222.         'get the table entry, then see if it's null
  223.         
  224.         fileServerName$ = String$(48, 0)
  225.         GetFileServerName connID&, fileServerName$
  226.         If Left$(fileServerName$, 1) <> Chr$(0) Then
  227.             'you have to explicitly look for a null in the first character,
  228.             'because Visual Basic doesn't know about null-terminated strings
  229.             '(a null prints as a space)
  230.             
  231.             ServerNameBox.AddItem fileServerName$
  232.         End If
  233.     Next connID&
  234.  
  235.     ScanBindery     'scan the bindery of the default server
  236. End Sub
  237.  
  238. Sub RescanButton_Click ()
  239.     ServerNameBox_DblClick  'same effect as if the user had
  240.                             'double-clicked on a file server name
  241. End Sub
  242.  
  243. Sub ScanBindery ()
  244.     Dim objectType As String * 6
  245.  
  246.     Screen.MousePointer = 11        'change mouse cursor to hourglass
  247.  
  248.     Do While BinderyObjList.ListCount
  249.         'clear out the old list of bindery objects
  250.         BinderyObjList.RemoveItem 0
  251.     Loop
  252.  
  253.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  254.     Do
  255.         oName$ = String$(48, 0)
  256.         ccode% = ScanBinderyObject("*", OT_WILD, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  257.         If (Not ccode%) Then
  258.             'take all characters of object name up to terminating null
  259.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  260.  
  261.             'then take first 20 chars
  262.             out$ = Left$(out$, 20)
  263.  
  264.             'pad with space